package com.spzx.user.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.user.api.RemoteUserInfoService;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserAddress;
import com.spzx.user.api.domain.UserInfo;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * ClassName: RemoteUserInfoFallbackFactory
 * Package: com.spzx.user.api.factory
 * Description:
 *
 * @Author 咚咚小圆帽
 * @Create 2025/3/25 16:28
 * @Version 1.0
 */
public class RemoteUserInfoFallbackFactory implements FallbackFactory<RemoteUserInfoService> {
    @Override
    public RemoteUserInfoService create(Throwable cause) {
        return new RemoteUserInfoService() {
            @Override
            public R<Boolean> register(UserInfo userInfo, String source) {
                return R.fail("会员注册失败：" + cause.getMessage());
            }

            @Override
            public R<UserInfo> getUserInfo(String username, String source) {
                return R.fail("根据用户名获取会员信息失败:" + cause.getMessage());
            }

            @Override
            public R<Boolean> updateUserLogin(UpdateUserLogin updateUserLogin, String source) {
                return R.fail("更新会员登录信息失败:" + cause.getMessage());
            }
        };

    }
}
